package com.credithc.signature.job.constant;

import java.util.concurrent.ConcurrentHashMap;

/**
 * @author hujingbo
 */
public enum DelayTypeEnum {

    /**
     * 延时一分钟
     */
    DELAY_1m(1, 60 * 1000),
    /**
     * 延时三分钟
     */
    DELAY_3m(2, 3 * 60 * 1000),
    /**
     * 延时五分钟
     */
    DELAY_5m(3, 5 * 60 * 1000),
    /**
     * 延时三十分钟
     */
    DELAY_30m(4, 30 * 60 * 1000),
    /**
     * 延时六十分钟
     */
    DELAY_60m(5, 60 * 60 * 1000);


    int delayType;
    int delayValue;

    DelayTypeEnum(int delayType, int delayValue) {
        this.delayType = delayType;
        this.delayValue = delayValue;
    }

    public int getDelayType() {
        return delayType;
    }

    public int getDelayValue() {
        return delayValue;
    }

    private static final ConcurrentHashMap hashMap = new ConcurrentHashMap<>(10);

    static {
        hashMap.put(1, DELAY_1m);
        hashMap.put(2, DELAY_3m);
        hashMap.put(3, DELAY_5m);
        hashMap.put(4, DELAY_30m);
        hashMap.put(5, DELAY_60m);
    }

    public static DelayTypeEnum getDelayTypeEnumByType(int delayType) {
        DelayTypeEnum delayTypeEnum = (DelayTypeEnum) hashMap.get(delayType);
        return delayTypeEnum;
    }
}
